type Options = Partial<{
    method:"GET" | "HEAD" | "PATCH" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "get" | "head" | "patch" | "post" | "put" | "delete" | "connect" | "options" | "trace" | undefined,
    query:Record<string,any>,
    params:Record<string,any>,
    body:Record<string,any>,
    headers:Record<string,any>,
    baseURL:string
}>
const baseOptions = {
    method:'get',
    headers:{}
}
export default function<T>(url:string,options:Options,isServer=false){
    const config = useRuntimeConfig()
    const {NUXT_REMOTE_URL,NUXT_BASE_URL} = config.public;
    const opts = Object.assign({},baseOptions,options);
    opts.baseURL = isServer ?NUXT_REMOTE_URL:NUXT_BASE_URL;
    return $fetch<T>(url,opts);
}